/*
 * @Author: 段本显
 * @Desc: 文件简介
 * @Date: 2021-08-06 11:40:34
 * @LastEditors: 段本显
 * @LastEditTime: 2021-08-10 13:40:54
 * @Email: duanbenxian@jianq.com
 * @Mark: 如果有bug，那肯定不是我的锅，噜噜噜
 */
import { createApp, Component } from 'vue'
import i18n from '@/lang'
import router from '@/router'
import store from '@store'
import globalProperties from '@/globalProperties'
import Element from './element'
import App from '@/App.vue'
interface FileType {
  [key: string]: Component
}

const app = createApp(App)
app.config.globalProperties = globalProperties

/* 全局组件注册 */
const files: Record<string, FileType> = import.meta.globEager(
  './components/**/**.vue'
)
Object.keys(files).forEach((c: string) => {
  const component = files[c]?.default
  // 挂载全局控件
  const _name: string = c.split('/').slice(-1)[0].replace('.vue', '')
  app.component(_name, component)
})

app.use(i18n).use(router).use(store).use(Element).mount('#app')
